home *** CD-ROM | disk | FTP | other *** search
/ HyperLib 1997 Winter - Disc 1 / HYPERLIB-1997-Winter-CD1.ISO.7z / HYPERLIB-1997-Winter-CD1.ISO / オンラインウェア / PRG / KeyboardState 1.0 folder.sit / KeyboardState 1.0 folder / KeyboardState 1.0 / KeyboardState Read Me < prev    next >
Text File  |  1996-01-15  |  3KB  |  26 lines

  1. KeyboardState 1.0
  2.  
  3.  
  4. About KeyboardState 1.0
  5. This program was born out of necessity. I was working on a project and needed to know if the command key was down, but didnユt know how to find out. After a quick look at Inside Mac (Inside Macintosh: Macintosh Toolbox Essentials, pg. 2-110 if you want more info), I found that the function GetKeys would allow me to do that.
  6.  
  7. About GetKeys
  8. Normally you only get a keypress through keyDown events, but you can also see which keys are pressed at any time by calling the function GetKeys. GetKeys returns a map of the keyboard. A KeyMap is declared (in メEvents.hモ) as an array of 4 long ints, so itユs 128 bits in all. Each key on the keyboard has a corresponding bit in the map. The bit is 1 in the key is down, 0 if itユs up. A maximum of two keys and any combination of the modifiers can be down at one time. By using GetKeys, itユs possible to check for keys that donユt produce keyDown events, such as the command, option, control, shift, caps lock, and even the power-on key.
  9.  
  10. Using KeyboardState 1.0
  11. Using the application is easy: launch it and start pressing keys. The first time the application is launched the window will appear in its default position. After that, the window will appear in the location it was the last time the application was quit. To quit the application, select Quit from the File menu or close its window.
  12.  
  13. KeyboardState displays each of the four long ints in its binary representation, so you can see each individual bit, and also in hexadecimal form. The default is to show all the bits as either 0 or 1, but it can display only the bits that are on by turning off メShow all bitsモ in the File menu. When メShow all bitsモ is off, ones are displayed as bullets (メ・モ) and zeroes arenユt displayed at all. I think this view makes it easier to see changes in the map. This setting is saved between launches.
  14.  
  15. Notes
  16. I wrote this application as quickly as I could because it was originally for my own use only, so I didnユt take the time to have it check its environment. You need System 7 because it uses an off-screen GWorlds to prevent flickering when the map is redrawn. I also didnユt want to bother supporting a separate preferences file, so the window location and view setting is stored within the application itself. If the window ever gets lost, simply delete resource of type PREF and it will appear in the default location the next time KeyboardState is launched. If these are problems for anybody, let me know and I may fix them.
  17.  
  18. How to contact me
  19. If you have comments or suggestions, I can be reached at jalvarad@oboe.aix.calpoly.edu. Donユt send email to the AOL account since I only check that once or twice a month (if I donユt cancel my account) as opposed to once or twice a day for my school internet account.
  20.  
  21. Disclaimer
  22. The program KeyboardState is supplied メas is.モ The programmer makes no guarantees and assumes no responsibility for any damage or loss of data that may result from its use.
  23.  
  24. Revision History
  25. Version 1.0 ミ January 15, 1996: Original release.
  26.